﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Meqs.Entity;
using Meqs.Logic.Interface;
using System.Collections.Generic;

public partial class Custom_ucSubject : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            repeatSubject2.DataSource = GetAllSubjects();
            repeatSubject2.DataBind();
        }
    }


    protected int currIn = 0;
    protected string GetOption(int rid, string ClsName)
    {
        string str = "<option value=" + rid + " " + ((rid >0) ? "" : "selected='selected'") + ">" + ClsName + "</option>";
        currIn = 0;
        return str;
    }

    /// <summary>
    /// 获取所有局级科目
    /// </summary>
    /// <returns></returns>
    private List<GlobalCauseInfo> GetAllSubjects()
    {
        int examId = 0;
        int examType = -1;

        examType = SchoolCookie.ExamType;
        examId = SchoolCookie.ExamID;

        List<GlobalCauseInfo> list = new List<GlobalCauseInfo>();
        if (examId > 0)
        {
            if (examType == 1)
            {
                IGlobalCauseInfoLogic subjectLogic = Container<IGlobalCauseInfoLogic>.Instance;
                list = (List<GlobalCauseInfo>)subjectLogic.SelectEduExamCause(examId);

                GlobalCauseInfo item = new GlobalCauseInfo();
                item.CauseName = "总分";
                item.RID = 0;
                list.Insert(0, item);
            }
            else
            {
                IGlobalCauseInfoLogic subjectLogic = Container<IGlobalCauseInfoLogic>.Instance;
                list = (List<GlobalCauseInfo>)subjectLogic.SelectSchoolExamCause(examId, CommonScore.GetSchoolMark);

                GlobalCauseInfo item = new GlobalCauseInfo();
                item.CauseName = "总分";
                item.RID = 0;
                list.Insert(0, item);
            }
 
        }
        return list;
    }
}
